import 'package:flutter/material.dart';
import 'package:oli/generated/l10n.dart';
import 'package:oli/page/home/main.dart';
import 'package:oli/page/message/main.dart';
import 'package:oli/page/my/main.dart';
import 'package:oli/page/order/main.dart';

class MainBottomNavigationBar {
  static final List<Widget> pages = [
    HomePage(),
    OrderPage(),
    MessagePage(),
    MyPage(),
  ];

  static final List<BottomNavigationBarItem> items = [
    buildBarItem(title: S.current.home, icon: Icon(Icons.home)),
    buildBarItem(title: S.current.order, icon: Icon(Icons.description)),
    buildBarItem(title: S.current.message, icon: Icon(Icons.notifications)),
    buildBarItem(title: S.current.my, icon: Icon(Icons.person)),
  ];

  // 底部导航 Icon 生成器
  static BottomNavigationBarItem buildBarItem ({
    String title = "",
    Icon icon = const Icon(Icons.settings),
    Icon activeIcon,
  }) {
    if(activeIcon == null) {
      activeIcon = icon;
    }
    return BottomNavigationBarItem(
        title: Text(title),
        icon: icon,
        activeIcon: activeIcon
    );
  }
}